#include<iostream>
#include<algorithm>
using namespace std;
int n, m;
int arr[1001];
int brr[1001];
int main()
{
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> arr[i] >> brr[i];
	}
	int count = 0;
	for (int i = 0; i < n - 1; i++) {
		for (int j = 0; j < n - 1 - i; j++) {
			if (brr[j]<brr[j + 1] || brr[j] == brr[j + 1] && arr[j]>arr[j + 1]) {
				swap(arr[j], arr[j + 1]);
				swap(brr[j], brr[j + 1]);
			}
		}
	}
	m *= 1.5;
	for (int i = 0; i < n; i++) {
		if (brr[i] <= brr[m]) {
			count++;
		}
	}
	cout << brr[m] << count << endl;
	for (int i = 0; i < n; i++) {
		if (brr[i] <= brr[m]) {
			cout << arr[i] << " " << brr[i] << endl;
		}
	}
	return 0;
}